/**
 * WebUtils
 * 
 * 04/10/2013
 * 
 * Copyright GPL
 */
package info.victor.utils;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * This class has functions for doing web actions.
 */
public class WebUtils {

	/**
	 * this method redirects to another page
	 * @param request
	 * @param page
	 * @param response
	 */
	public static void redirect(HttpServlet servlet,
			HttpServletRequest request, String page,
					HttpServletResponse response){
		try {
			servlet.getServletContext().
					getRequestDispatcher(page).forward(request, response);
		} catch (ServletException | IOException e) {
			e.printStackTrace();
		}
	}
}
